package servlet;


import com.alibaba.fastjson.JSONArray;
import service.LogicService;
import service.s;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

@WebServlet(name = "/SelectMonth", value = "/SelectMonth")
public class SelectMonth extends HttpServlet {

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=UTF-8");

        String A = req.getParameter("name");
       String B = req.getParameter("m");
       String C = req.getParameter("y");

//       String A = "wang";
//      String B = "3";
//        String C = "2022";

        s s = new s();

        JSONArray jsonArray = new JSONArray();
        try {
            jsonArray = s.month(A, B, C);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        PrintWriter out = resp.getWriter();
        out.print(jsonArray);
        out.flush();
        out.close();
    }
}
